/*  
 * @(#) OracleDialect.java Create on 2014-2-24 下午10:17:14   
 *   
 * Copyright 2014 by fibrlink.   
 */

package com.springdemo.tools;

/**
 * 
 * @author san
 * @date 2014-2-24
 */
public class OracleDialect extends Dialect {

	@Override
	/*
	 * 
	 */
	public String getLimitString(String sql, int pageNow, int pageSize) {
		sql = sql.trim();
		StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);

		pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");

		pagingSelect.append(sql);

		pagingSelect.append(" ) row_ ) where rownum_ >= ").append(pageNow).append(" and rownum_ < ").append(pageNow + pageSize);
		return pagingSelect.toString();

	}

}
